package demo2;

public class Tect {
    public static void main(String[] args) {
        Cycle cycle = new Cycle();
        Flower flower = new Flower();
        Rect rect = new Rect();
        Shape[] shapes1 = {cycle,flower,rect,cycle,flower,rect};
        String[] shapes2 = {"cycle","flower","rect","cycle","flower","rect"};
        for(Shape shape : shapes1){
            shape.draw();
        }

        for(int i = 0; i < shapes2.length;i++){
            String s = shapes2[i];
            if(s.equals("cycle")){
                System.out.println("一个圆");
            } else if (s.equals("flower")  ) {
                System.out.println("一朵花");
            }else {
                System.out.println("三角型");
            }
        }
    }
}
